package com.example.service;

import com.example.pojo.Ticket;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 负载均衡 feign
 * 请求访问服务提供者的接口信息,请求路径要保持和provider的controller中的path一致才可以
 */
@Component
@FeignClient(value = "PROVIDER-TICKET",fallbackFactory = TicketServiceFallbackFactory.class) //熔断降级
//fallbackFactory指定降级配置类
@RequestMapping("/ticket")
public interface TicketFeignService {

    @GetMapping("/selectAll")
    List<Ticket> selectAll();

    @PostMapping("/insertTicket")
    boolean insertTicket(Ticket ticket);

    @GetMapping("/getTicket/{id}")
    Ticket getTicket(@PathVariable("id") Long id);

//    @DeleteMapping("/deleteTicket/{id}")
//    boolean deleteTicket(@PathVariable("id") Long id);

}
